#include "chat_message.h"
#include "server.h"

#include <boost/asio.hpp>

#include <deque>
#include <iostream>
#include <memory>
#include <set>
#include <list>
#include <utility>

#include <cstdlib>

int main(int argc, char* argv[]) {

    try {
        if(argc < 2) {
            std::cerr << "Usage: main_server <port> [<port> ...]" << std::endl;
            return 1;
        }
        
        boost::asio::io_service io_service;

        std::list<chat_server> servers;
        
        for(int i=1; i<argc; ++i) {
            tcp::endpoint endpoint(tcp::v4(), std::atoi(argv[i]));
            servers.emplace_back(io_service, endpoint);
        }
        io_service.run();

    }catch(std::exception& e) {
        std::cerr << "Exception: " << e.what() << std::endl; 
    }

    return 0;
}